var sequelize=require("./sequelize.js");
const Sequelize=require("sequelize");

sequelize.define('cat', {//分类管理id
	id: {//主键
		primaryKey:true,
		autoIncrement:true,
		allowNull:false,
		type: Sequelize.INTEGER
	},
	pid: {//父级节点id
		type: Sequelize.INTEGER
	},
	name:{//节点名称
		type: Sequelize.STRING
	},
	uniqid:{//唯一id
		type: Sequelize.STRING
	}
});
sequelize.define('flow', {//每一条为流程的一个节点
	id: {//主键
		primaryKey:true,
		autoIncrement:true,
		allowNull:false,
		type: Sequelize.INTEGER
	},
	name:{//节点名称
		type: Sequelize.STRING
	},
	desc:{//节点描述
		type: Sequelize.TEXT
	},
	catId: {//节点所属流程id
		type: Sequelize.INTEGER
	},
	userId: {//用户名
		type: Sequelize.INTEGER
	},
	step: {//节点所属第几步
		type: Sequelize.INTEGER
	},
	isActive:{//是否为活动状态
		type: Sequelize.BOOLEAN
	},
	dependance:{//节点依赖数据{field:{table:"xxx",field:"xxx",value:"xxx"}}
		type: Sequelize.TEXT
	},
	collect:{//需要收集的数据[{field:value}]--会呈现在页面表单上
		type: Sequelize.TEXT
	},
	action:{//节点要执行的动作['aaa','bbb','ccc']
		type: Sequelize.TEXT
	},
	page:{//节点对应页面
		type: Sequelize.STRING
	},
	uniqid:{//唯一id
		type: Sequelize.STRING,
		len: [2,22]
	}
});

module.exports=sequelize
